
package com.plian.system.service.fr.authorize.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.plian.system.entity.fr.authorize.AuthorizeTableVersion;
import com.plian.system.mapper.fr.authorize.AuthorizeTableVersionMapper;
import com.plian.system.service.fr.authorize.IAuthorizeTableVersionService;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * 年份和版本关系 服务实现类
 *
 * @author panqb
 * @since 2021-09-27
 */
@Service
@AllArgsConstructor
public class AuthorizeVersionServiceImpl extends ServiceImpl<AuthorizeTableVersionMapper, AuthorizeTableVersion> implements IAuthorizeTableVersionService {
    /**
     * logger属性.
     */
    private static final Logger LOGGER  = LoggerFactory.getLogger(AuthorizeVersionServiceImpl.class);


    @Override
    public String getVersion(String year) {
        AuthorizeTableVersion authorizeTableVersion = getOne(new QueryWrapper<AuthorizeTableVersion>().eq("year", year));
        return Optional.ofNullable(authorizeTableVersion).isPresent() ? authorizeTableVersion.getVersion() : "1.0";
    }
}
